package com.easpeed.elevator.bean;

/**
 * Created by bigyu on 2024/10/17 19:13
 * com.easpeed.elevator.bean
 */
public class EventInfo {


    private String eventId;
    private String eventType;
    private float startDistance;

    private float crsh;
    private float fdsh;
    private float hbsh;
    private float fdshTotla;

    private float distanceTottal = 0f;
    public EventInfo(String eventId, String eventType, float startDistance, float crsh, float fdsh, float hbsh, float fdshTotla, float distanceTottal) {
        this.eventId = eventId;
        this.eventType = eventType;
        this.startDistance = checkData(startDistance);

        this.distanceTottal = checkData(distanceTottal);
        this.crsh = checkData(crsh);
        this.fdsh = checkData(fdsh);
        this.hbsh = checkData(hbsh);
        this.fdshTotla = checkData(fdshTotla);
    }
    public EventInfo(String eventId, String eventType, float startDistance, float crsh, float fdsh, float hbsh, float fdshTotla) {
        this.eventId = eventId;
        this.eventType = eventType;
        this.startDistance = checkData(startDistance);

        this.crsh = checkData(crsh);
        this.fdsh = checkData(fdsh);
        this.hbsh = checkData(hbsh);
        this.fdshTotla = checkData(fdshTotla);
    }

    private float checkData(float f) {
        if (Float.isNaN(f) || Float.isInfinite(f)) {
            f = 0f; // 替换为默认值
        }
        return f;
    }

    public String getEventId() {
        return eventId;
    }

    public void setEventId(String eventId) {
        this.eventId = eventId;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }

    public float getStartDistance() {
        return startDistance;
    }


    public float getCrsh() {
        return crsh;
    }

    public float getFdsh() {
        return fdsh;
    }

    public float getHbsh() {
        return hbsh;
    }

    public float getFdshTotla() {
        return fdshTotla;


    }

    public void setStartDistance(float startDistance) {
        this.startDistance = startDistance;
    }

    public void setCrsh(float crsh) {
        this.crsh = crsh;
    }

    public void setFdsh(float fdsh) {
        this.fdsh = fdsh;
    }

    public void setHbsh(float hbsh) {
        this.hbsh = hbsh;
    }

    public void setFdshTotla(float fdshTotla) {
        this.fdshTotla = fdshTotla;
    }

    public float getDistanceTottal() {
        return distanceTottal;
    }

    public void setDistanceTottal(float distanceTottal) {
        this.distanceTottal = distanceTottal;
    }

    @Override
    public String toString() {
        return "EventInfo{" +
                "eventId='" + eventId + '\'' +
                ", eventType='" + eventType + '\'' +
                ", startDistance=" + startDistance +
                ", crsh=" + crsh +
                ", fdsh=" + fdsh +
                ", hbsh=" + hbsh +
                ", fdshTotla=" + fdshTotla +
                '}';
    }
}
